
begintalkscript;

variables;
int pc_counter, in_inn;

begintalknode 1;
	state = -1;
	nextstate = -1;
	question = "Guard";
	text1 = "This guard doesn't seem to want to talk to you. He anxiously shifts from foot to foot, avoiding eye contact with you.";
	text2 = "This guard just snickers when he makes eye contact with you. Still, he seems a bit nervous, and he anxiously shifts from foot to foot.";
	text3 = "He's probably just nervous about the ghosts.";
	code = 
		remove_string(2);
		if(get_flag(1,4) == 0)
			remove_string(3);
		if(get_flag(30,4) == 1) {
			add_string(2);
			remove_string(1);
		}
	break;
begintalknode 2;
	state = -1;
	nextstate = 2;
	question = "Guard";
	text1 = "You remember this rather frazzled-looking guard as the one who asked you to find his friend Jack. He stands shifting uneasily from foot to foot, occasionally looking towards the top of the cathedral with a concerned expression.";
	text2 = "He doesn't seem to be in the mood for conversation.";
	text3 = "You remember this rather frazzled-looking guard as the one who asked you to find his friend Jack. Of course, now that you've rescued his friend, he doesn't seem as nervous.";
	text4 = "Still, he doesn't seem to be in the mood for conversation.";
	code = 
		if(get_flag(4,1) == 5) {
			remove_string(1);
			remove_string(2);
		}
		else {
		remove_string(3);
		remove_string(4);
	}
	break;
begintalknode 3;
	state = -1;
	nextstate = -1;
	question = "Archer";
	text1 = "This archer seems to be preoccupied with scanning the forest for potential threats. You try to strike up a conversation, but the attempt fails.";
	text2 = "This archer seems to be preoccupied with scanning the forest for potential threats. You try to strike up a conversation, but the archer just laughs when you talk to him.";
	code = 
		remove_string(2);
		if(get_flag(30,4) == 1) {
			add_string(2);
			remove_string(1);
		}
	break;
begintalknode 4;
	state = 2;
	nextstate = -1;
	question = "So, what are you doing here?";
	text1 = "The guard doesn't respond. He just shakes.";
	text2 = "He's probably still trying to shake off his encounter with the ghosts.";

begintalknode 5;
	state = 2;
	nextstate = -1;
	condition = get_flag(4,1) < 2;
	question = "Where was your friend again?";
	text1 = "_Third floor. Somewhere. The ghosts took him._";
	text2 = "That's all you get out of him.";

begintalknode 10;
	state = -1;
	nextstate = 10;
	question = "Father Richardson";
	text1 = "The first thing you notice about this man is his age. He's clearly very, very old, and he has the sort of washed-out look that you're used to seeing among elderly mages. Mages who used magic to extend their lives.";
	text2 = "Still, when he greets you, you hear enough warmth in his voice to convince you that he's nowhere near death's door.";
	text3 = "_Greetings, friends. I trust that you all want to know exactly why I've brought you here._";
	text4 = "_Greetings, friend. I trust that you want to know exactly why I've brought you here._";
	text5 = "Father Richardson patiently waits for you to speak.";
	text6 = "Father Richardson patiently waits for you to speak. He seems much more relaxed than he was before, almost definitely due to the fact that the ghosts are gone.";
	text7 = "Father Richardson patiently waits for you to speak. He seems a bit shaken.";
	action = INTRO;
	code = 
		if(party_size() == 1) {
			remove_string(3);
		}
		else {
		remove_string(4);
	}
	remove_string(5);
	remove_string(6);
	remove_string(7);
	if(get_flag(50,1) == 0)
		add_string(5);
	if(get_flag(50,1) == 1)
		add_string(6);
	if(get_flag(50,1) == 2)
		add_string(7);
	break;
begintalknode 11;
	state = 10;
	nextstate = -1;
	condition = (party_size() != 1) && (get_flag(1,4) == 0);
	question = "What do you need us to do?";
	text1 = "The elderly priest clears his throat. _The Cathedral of Winds has recently developed a pest problem... one that has resisted our best attempts at exterminating it._";
	text2 = "_Specifically, an uncomfortably large group of angry spirits has arisen from the bodies buried in the catacombs, and we need you to send them to their eternal rest. And the sooner, the better._";
	text3 = "_Now, I think you should go speak to Felix. He's down in the catacombs, and he'll tell you exactly what you'll be doing down there._";
	code = 
		set_flag(1,4,1);
		toggle_quest(1,0);
		toggle_quest(3,1);
		if(get_highest_skill(12) < 3)
			add_item_to_shop(5000,12,3);
	break;
begintalknode 12;
	state = 10;
	nextstate = -1;
	condition = (party_size() == 1) && (get_flag(1,4) == 0);
	question = "What do you need me to do?";
	text1 = "The elderly priest clears his throat. _The Cathedral of Winds has recently developed a pest problem... one that has resisted our best attempts at exterminating it._";
	text2 = "_Specifically, an uncomfortably large group of angry spirits has arisen from the bodies buried in the catacombs, and we need you to send them to their eternal rest. And the sooner, the better._";
	text3 = "_Now, I think you should go speak to Felix. He's down in the catacombs, and he'll tell you exactly what you'll be doing down there._";
	code = 
		set_flag(1,4,1);
		toggle_quest(1,0);
		toggle_quest(3,1);
		if(get_highest_skill(12) < 3)
			add_item_to_shop(5000,12,3);
	break;
begintalknode 13;
	state = 10;
	nextstate = 11;
	condition = get_flag(1,4) == 1;
	question = "You're a priest. Why can't you handle all of this yourself?";
	text1 = "Father Richardson attempts to stand, but falls back into his chair after a brief struggle. _I am old, as you can see. All the holy magic in Relonar cannot return the vitality I once had. And yet, even if I were younger, I could not defeat these spirits._";
	text2 = "_You see, they are older than anyone in this cathedral. While many spirits fade away over time, it seems that these have only grown stronger, to the point where I can no longer be of much aid in controlling them._";

begintalknode 14;
	state = 11;
	nextstate = 12;
	question = "But surely there are other younger priests here. Can't they help?";
	text1 = "_We have tried, believe me. Brother Silas has not recovered from our first attempt, and it will likely be some time before we figure out exactly what is wrong with him._";
	text2 = "The elderly priest sighs. _The others do not have the experience, and I do not have the strength. So, we have turned to you for help._";

begintalknode 15;
	state = 10;
	nextstate = -1;
	condition = get_flag(1,4) > 0;
	question = "What makes these spirits so special?";
	text1 = "_Well, first and foremost they are angry. I'm not exactly sure why they're angry, but they are. It's strange, as the bodies they once inhabited were cared for and given a proper burial in the catacombs._";
	text2 = "_In any event, the spirits themselves are unwilling to disclose their motives to us. Perhaps you will have more success than us. We have yet to get close enough to them to learn much else._";

begintalknode 16;
	state = 12;
	nextstate = -1;
	condition = get_flag(1,7) == 0;
	question = "Where is Brother Silas now?";
	text1 = "_The last time I saw him, he was cowering in one of the meditation cells upstairs. He has not spoken to anyone in days, and he has barely eaten anything._";
	text2 = "He solemnly shakes his head. _It is clear that our healing was not enough to save his mind, so he will be sent to the mages in Barton to see if they can devise a cure. Or, at the very least, if they can tell us what happened to him._";
	code = 
		if(get_flag(1,7) == 0)
			set_flag(1,7,1);
	break;
begintalknode 17;
	state = 10;
	nextstate = 13;
	condition = (get_flag(1,4) > 0) && (party_size() == 1);
	question = "Can you give me any help?";
	text1 = "_Well, I'm afraid you must do the bulk of the work here, but I may be able to aid you with a few spells. I can teach them to you if you wish, though I must charge a nominal fee._";
	text2 = "_Also, should the task prove to be too much for you, you may return to me for healing at any time. For that, I ask a modest price of 200 coins, since you are doing us all a favor._";
	text3 = "_As I told you before, I can teach you spells, or I can heal you for 200 coins. Is either necessary?_";
	code = 
		if(get_flag(1,6) != 0) {
			remove_string(1);
			remove_string(2);
		}
		else {
		remove_string(3);
		set_flag(1,6,1);
	}
	break;
begintalknode 18;
	state = 10;
	nextstate = -1;
	condition = (get_flag(1,4) > 0) && (get_flag(1,5) == 0) && (get_flag(8,0) == 0);
	question = "Where are the catacombs?";
	text1 = "Father Richardson laughs, a slightly discomforting sight. It looks more like uncontrolled wheezing.";
	text2 = "_Under the cathedral, of course. But I assume you mean the entrance. It's just on the other side of that wall,_ he says, pointing to the west wall.";
	code = 
		set_flag(1,5,1);
	break;
begintalknode 19;
	state = 10;
	nextstate = 13;
	condition = (get_flag(1,4) > 0) && (party_size() != 1);
	question = "Can you give us any help?";
	text1 = "_Well, I'm afraid you must do the bulk of the work here, but I may be able to aid you with a few spells. I can teach them to you if you wish, though I must charge a nominal fee._";
	text2 = "_Also, should the task prove to be too much for you, you may return to me for healing at any time. For that, I ask a modest price of 200 coins per person, since you are doing us all a favor._";
	text3 = "_As I told you before, I can teach you spells, or I can heal you for 200 coins. Is either necessary?_";
	code = 
		if(get_flag(1,6) != 0) {
			remove_string(1);
			remove_string(2);
		}
		else {
		remove_string(3);
		set_flag(1,6,1);
	}
	break;
begintalknode 20;
	state = 13;
	nextstate = -1;
	question = "What spells can you teach?";
	text1 = "Father Richardson explains the spells he can teach, and soon you finish shopping.";
	text2 = "_Anything else?_";
	code = 
		begin_shop_mode("Father Richardson's Spells","Father Richardson offers to teach you a decent variety of spells, at prices you're not used to seeing.",8,1,-1);
	break;
begintalknode 21;
	state = 13;
	nextstate = -1;
	question = "How about some healing? (200 coins)";
	text1 = "Father Richardson sighs. _Well, I am glad that you do not need it. Perhaps it will make your job easier._";
	text3 = "Father Richardson waves his arms, and you feel a wave of holy energy wash over you, healing you.";
	text4 = "_There, I hope that is enough to sustain you._";
	text5 = "Father Richardson sighs. _I cannot heal you for free._";
	code = 
		if(coins_amount() < 200) {
			clear_strings();
			add_string(5);
		}
		else {
		run_select_a_pc(1);
		if(get_selected_pc() == -1) {
			clear_strings();
			add_string(1);
		}
		else {
		play_sound(24);
		clear_strings();
		add_string(3);
		add_string(4);
		restore_pc(get_selected_pc());
		change_coins(-200);
	}
}
	break;
begintalknode 22;
	state = 13;
	nextstate = 10;
	question = "No thanks, that's it for now.";
	text1 = "_Very well. Is there anything else you wish to talk about?_";

begintalknode 23;
	state = 10;
	nextstate = 14;
	condition = (get_flag(1,4) > 0) && (party_size() == 1);
	question = "Tell me about your faith.";
	text1 = "Father Richardson sighs. _Honestly? Hardly any of the adventurers that come through here really care about our faith, and right now I'd rather just tell you to get on with your work. But, our church did not last this long by turning away the curious._";
	text2 = "_This is the Cathedral of Winds, and myself and the other priests here in Relonar form the Church of the Four Winds. We worship the supreme power of the winds: North, East, South, and West._";
	text3 = "_What else do you wish to know?_";
	text4 = "_I believe I have taught you as much as is necessary right now, and I think it would benefit all of us if you would get on with your quest._";
	code = 
		if(get_flag(1,8) != 0) {
			remove_string(1);
			remove_string(2);
			if(get_flag(1,8) < 3)
				remove_string(4);
			else if(get_flag(1,8) == 3) {
			remove_string(3);
			set_flag(1,8,4);
		}
	}
	else {
	remove_string(3);
	remove_string(4);
	set_flag(1,8,1);
}
	break;
begintalknode 24;
	state = 10;
	nextstate = 14;
	condition = (get_flag(1,4) > 0) && (party_size() != 1);
	question = "Tell us about your faith.";
	text1 = "Father Richardson sighs. _Honestly? Hardly any of the adventurers that come through here really care about our faith, and right now I'd rather just tell you to get on with your work. But, our church did not last this long by turning away the curious._";
	text2 = "_This is the Cathedral of Winds, and myself and the other priests here in Relonar form the Church of the Four Winds. We worship the supreme power of the winds: North, East, South, and West._";
	text3 = "_What else do you wish to know?_";
	text4 = "_I believe I have taught you as much as is necessary right now, and I think it would benefit all of us if you would get on with your quest._";
	code = 
		if(get_flag(1,8) != 0) {
			remove_string(1);
			remove_string(2);
			if(get_flag(1,8) < 3)
				remove_string(4);
			else if(get_flag(1,8) == 3) {
			remove_string(3);
			set_flag(1,8,4);
		}
	}
	else {
	remove_string(3);
	remove_string(4);
	set_flag(1,8,1);
}
	break;
begintalknode 25;
	state = 14;
	nextstate = -1;
	condition = get_flag(1,9) == 0;
	question = "Why do you worship the winds?";
	text1 = "_Because we believe in the unstoppable power of the winds, of course! Each wind brings us different gifts and challenges, and together they balance out to perfect harmony._";
	text2 = "_The winds are unpredictable, just as much as any of the other entities you see worshipped everywhere. They shape our world in ways we cannot even begin to comprehend. And thus, we feel they are worthy of our worship._";
	code = 
		set_flag(1,9,1);
		inc_flag(1,8,1);
	break;
begintalknode 26;
	state = 14;
	nextstate = -1;
	condition = get_flag(1,10) == 0;
	question = "Are there more cathedrals like this around here?";
	text1 = "_This is the only cathedral of this size in Relonar. Others exist, though most of the truly impressive ones are in Pralgad. Compared to those mighty spires, this cathedral is quite humble indeed._";
	text2 = "_Most of the other priests who follow the Church of the Winds are scattered about the province, teaching out of smaller shrines and temples. This is our stronghold._";
	code = 
		set_flag(1,10,1);
		inc_flag(1,8,1);
	break;
begintalknode 27;
	state = 10;
	nextstate = -1;
	condition = (get_flag(50,0) == 1) && (get_flag(1,4) == 1);
	question = "The ghosts are loose. What now?";
	text1 = "Father Richardson sighs. _I know. I can feel their presence outside of the sanctuary. That is why everyone is here. The energy of the altars shelters us from the ghosts' mental assaults, and I am able to repel some of their energy._";
	text2 = "_It seems that the wards are slowly failing, both those in the stonework of the building itself and the machinery installed by the Empire. What we need you to do is repair them, and Felix can tell you how to go about that._";
	text3 = "_Do be careful, though. The spirits of those soldiers are clearly willing to go to any length to escape._";
	code = 
		set_flag(1,4,2);
		toggle_quest(6,1);
	break;
begintalknode 28;
	state = 10;
	nextstate = -1;
	condition = (get_flag(50,1) == 1)  && (get_flag(1,4) == 2);
	question = "The ghosts are gone.";
	text1 = "Father Richardson smiles. _Yes, we know, and we are forever indebted to you. Now, we can focus on healing ourselves, and bringing our flock back to the church._";
	text2 = "_Oh, and then there's the matter of your reward,_ he says, extending his arms. A soft white light envelops him, and you feel a soothing wave of energy wash over you.";
	text3 = "_Consider yourselves honorary members of the Church of Winds._";
	text4 = "_Consider yourselves an honorary member of the Church of Winds._";
	code = 
		set_flag(1,4,3);
		if(party_size() == 1)
			remove_string(4);
		else
		remove_string(3);
		alter_stat(1000,12,1);
		award_party_xp(1000,20);
	break;
begintalknode 29;
	state = 10;
	nextstate = -1;
	condition = (get_flag(50,1) == 2) && (get_flag(1,4) == 2);
	question = "So what happened?";
	text1 = "Father Richadson sighs. _They are gone. We don't know where... but they're gone._";
	text2 = "_But we recognize the trouble you went through to help us, and we appreciate it,_ he says, pulling a smallish sack of coins from his robes. He tosses it to you.";
	text3 = "_Now, we simply have to undo the damage done to the cathedral, and to ourselves. And we'll have to deal with the few remaining ghosts. But for now, we can manage._";
	text4 = "_Consider yourself discharged from our service._";
	text5 = "_Consider yourselves discharged from our service._";
	text6 = "Well, at least he doesn't know what you did. Or, if he does, he isn't letting on.";
	code = 
		set_flag(1,4,3);
		change_coins(300);
		if(party_size() == 1)
			remove_string(5);
		else
		remove_string(4);
		award_party_xp(200,20);
	break;
begintalknode 30;
	state = 10;
	nextstate = -1;
	condition = get_flag(50,1) != 0;
	question = "Is everyone alright?";
	text1 = "The ancient priest sighs. _Yes, I believe so. Felix and Brother Silas will need to be sent away to recover, but for the most part, we'll be fine. Thank you for your concern._";

begintalknode 40;
	state = -1;
	nextstate = 40;
	question = "Alyse";
	text1 = "A priestess is quietly kneeling here, but unlike many of the religious types you've burst in on, she actually notices your presence. She doesn't seem all that friendly, though.";
	text2 = "_I am Alyse, and I am responsible for tending the altars here. Why are you here?_";
	text5 = "Alyse quietly kneels before the altar, occasionally casting a hard glance at you.";
	text6 = "_Well, what do you have to say?_";
	action = INTRO;

begintalknode 41;
	state = 40;
	nextstate = 41;
	question = "Why are you praying?";
	text1 = "Alyse nods in the general direction of the altar.";
	text2 = "_I'm praying for this cathedral. Praying so that it may be cleansed and made ready for the people of Relonar to come and hear the gospel of the winds. That is the only way they may be saved._";

begintalknode 42;
	state = 41;
	nextstate = -1;
	condition = get_flag(1,15) == 0;
	question = "Are you worried about the ghosts?";
	text1 = "_Not in the least. As the north wind watches over us, so shall we be spared. Clearly, the north wind has chosen you to act as his guiding hand._";
	text2 = "_And as for our temporary confinement within the sanctuary, I am certain that this is only to protect us. The winds would not want us to be injured while you complete their task._";
	text3 = "You consider telling her that you were hired for this job, and that she should probably be afraid of the ghosts. Thankfully, you have more important work to be doing, so you refrain.";
	text4 = "_I was never worried about the ghosts. And soon, everything will return to normal. And as for you, I am fairly certain that we will be better off without you around._";
	text5 = "_I was never worried about the ghosts, and now they're gone, for better or worse. Soon everything will return to normal, and as for you, I am fairly certain that we will be better off without you._";
	text6 = "For a moment, you actually consider telling her how useless she is in the grand scheme of things, given the fact that adventurers tend to solve most of the major problems that face the Empire's citizens. However, you calm down and refrain.";
	code = 
		set_flag(1,15,1);
		if(get_flag(50,0) == 0)
			remove_string(2);
		if(get_flag(50,1) == 0) {
			remove_string(4);
			remove_string(5);
			remove_string(6);
		}
		else {
		clear_strings();
		add_string(6);
		if(get_flag(50,1) == 1)
			add_string(4);
		else
		add_string(5);
		
	}
	break;
begintalknode 43;
	state = 40;
	nextstate = 42;
	condition = get_flag(50,0) == 0;
	question = "Does this altar get a lot of use?";
	text1 = "_Well, most of the other priests prefer to use the altars in the sanctuary, but I like this one. That, and nobody else seems inclined to maintain it, not even Ethan. So, I do my duty to the winds and keep it clean._";
	text2 = "She sneers. _Whenever the common folk use it, they track in dirt. I even heard one swear in here. It's disgraceful._";
	code = 
		if(get_flag(1,17) == 0)
			set_flag(1,17,1);
	break;
begintalknode 44;
	state = 42;
	nextstate = -1;
	condition = get_flag(1,14) == 1;
	question = "Wait, isn't this supposed to be a public altar?";
	text1 = "Alyse frowns. _Well, if they don't start taking better care of it, then it won't be public for much longer._";
	text2 = "Huh. What a terribly unpleasant person.";
	code = 
		set_flag(1,14,2);
	break;
begintalknode 45;
	state = 40;
	nextstate = -1;
	condition = party_size() != 1;
	question = "Can you help us at all?";
	text1 = "_Well, I'm not allowed to teach magic, and I'm too busy seeking inner harmony to heal you, so no, not really._";
	text2 = "She resumes praying.";

begintalknode 46;
	state = 40;
	nextstate = -1;
	condition = party_size() == 1;
	question = "Can you help me at all?";
	text1 = "_Well, I'm not allowed to teach magic, and I'm too busy seeking inner harmony to heal you, so no, not really._";
	text2 = "She resumes praying.";

begintalknode 47;
	state = 42;
	nextstate = -1;
	condition = get_flag(1,17) == 2;
	question = "Ethan says he doesn't clean this altar just to mess with you.";
	text1 = "Alyse just stares at you for a while.";
	text2 = "_I'm going to ignore that comment, because something like that clearly isn't true. Because if it was true, I'd have to go seek a lengthy and painful bit of vengeance, and I don't have the energy for that right now._";
	code = 
		set_flag(1,17,3);
	break;
begintalknode 48;
	state = 41;
	nextstate = -1;
	condition = get_flag(1,20) == 0;
	question = "Do the people of Relonar really need saving?";
	text1 = "Alyse snorts. _Of course they do! They live in sin without even knowing it! By failing to bend for the mighty power of the winds, they can only be blown away when the winds of change choose to reshape life on this earth!_";
	text2 = "She continues in this vein for quite some time, ranting about salvation and damnation. None of it really registers with you, since you've heard this type of garbage many times before.";
	text3 = "You sincerely hope that not all of the cathedral's priests are this reactionary.";
	code = 
		set_flag(1,20,1);
	break;
begintalknode 49;
	state = -1;
	nextstate = 40;
	question = "Alyse";
	text1 = "A priestess is quietly kneeling here, but unlike many of the religious types you've burst in on, she actually notices your presence. She doesn't seem all that friendly, though.";
	text2 = "_I am Alyse, and I am responsible for tending the altars here. What brings you here?_";
	text5 = "You find Alyse kneeling in a pew, looking just as serenely hostile as before. She doesn't seem all that shaken up, but then again, you wouldn't expect her to be.";
	text6 = "Alyse is still here, just as hostile as before.";
	text7 = "_Well, what do you have to say?_";
	action = INTRO;
	code = 
		if(get_flag(11,0) == 1)
			remove_string(5);
		else {
		set_flag(11,0,1);
		remove_string(6);
	}
	break;
begintalknode 50;
	state = -1;
	nextstate = 50;
	question = "Ethan";
	text1 = "This middle-aged man is busy sweeping the floor. He's dressed like a priest, but his robe has a lot of dust on it, as well as a few unidentifiable stains. ";
	text2 = "He notices your presence, he just doesn't say anything until he finishes getting the pile of dust he's working on into a corner.";
	text3 = "_Greetings, friends. My name is Ethan._";
	text4 = "_Greetings, friend. My name is Ethan._";
	text5 = "Ethan continues sweeping the floor.";
	text6 = "_Well, what did you want to say?_";
	action = INTRO;
	code = 
		if(party_size() == 1)
			remove_string(3);
		else
		remove_string(4);
		set_flag(11,11,1);
	break;
begintalknode 51;
	state = 50;
	nextstate = -1;
	question = "What's your job here?";
	text1 = "He gestures to the broom.";
	text2 = "_I'm one of the few people around here who's willing to help keep this place clean. I scrub the floors, change out the torches, polish the pews, fix the locks, keep the stairs clear, and wash the windows._";
	text3 = "_Heck, just about the only things I don't do are care for the catacombs and gardens. Thankfully, we've got Felix and Paula for that. Catacombs give me the creeps, and I can't stand dirt,_ he says with a smile.";
	text6 = "Ethan just gestures to the broom again. _You've got a pretty bad memory, don't you? I clean up around here._";
	code = 
		if(get_flag(1,16) == 1) {
			clear_strings();
			add_string(6);
		}
		else {
		remove_string(6);
		set_flag(1,16,1);
	}
	break;
begintalknode 52;
	state = 50;
	nextstate = 51;
	question = "So, are you a priest?";
	text1 = "_Well, yes and no. Not in the sense that I expect you're used to, because I don't do magic. I just try to spread the goodwill of the church, and to keep the cathedral clean._";
	text2 = "He chuckles. _A priest without magic, just faith. How often do you see that nowadays?_";
	text3 = "_I'll tell you what, though. I wish I could cast a few spells, now that these ghosts seem to be here to stay._";
	text5 = "_I thought I told you already. I'm a priest, I just don't do magic._";
	text6 = "He chuckles. _A dying breed, in my mind._";
	code = 
		if(get_flag(1,22) == 0) {
			clear_strings();
			add_string(1);
			if(get_flag(50,0) == 0)
				add_string(2);
			else
			add_string(3);
			set_flag(1,22,1);
		}
		else {
		clear_strings();
		add_string(5);
		if(get_flag(50,0) == 0)
			add_string(6);
	}
	break;
begintalknode 53;
	state = 50;
	nextstate = 52;
	condition = get_flag(1,4) > 0;
	question = "What do you think of the whole ghost problem?";
	text1 = "_Well, as long as they don't get out of hand, I think I'll ride out the storm here. I mean, with as many magic-types as we've got, we should be fine._";
	text2 = "_Of course, if anything attacks me, I'm bolting for the exit. Or the sanctuary, whichever is closer at the time. I trust the winds to protect me, but I don't trust myself to fend off a persistent ghost._";
	text5 = "_Well, I've got to admit that I'm a bit frightened right now. I think we'll be safe in here, but if the ghosts break into the sanctuary, then I'm bolting for the exit, winds help me._";
	text6 = "_I'd just like to know how we got into this mess, really._";
	text7 = "You consider telling him what you know about the ghosts, but you decide that Ethan seems worried enough already.";
	text8 = "Ethan sighs. _Well, for better or worse, they're gone. So on the whole, I view that as an improvement. I'd just like to get everything back to normal._";
	code = 
		if(get_flag(50,0) == 0) {
			remove_string(5);
			remove_string(6);
			remove_string(7);
			remove_string(8);
		}
		else if(get_flag(50,1) == 0) {
		clear_strings();
		add_string(5);
		add_string(6);
		add_string(7);
	}
	else {
clear_strings();
add_string(8);
}
	break;
begintalknode 54;
	state = 50;
	nextstate = -1;
	condition = get_flag(1,17) == 1;
	question = "Alyse doesn't seem happy with your work.";
	text1 = "You tell Ethan what Alyse said about the condition of the altars. Ethan makes a sound somewhere between a sigh and a grunt.";
	text2 = "_By the winds, I can't stand her. She's the pickiest priest I've ever had the misfortune to cross paths with. Honestly, if I were you, I'd stay away from her. She's just nasty._";
	text3 = "_But seriously, the reason I don't clean that altar is that I really enjoy annoying Alyse. Don't tell her. Not so much because I'm worried about her getting even more unpleasant, but because it'd spoil the fun._";
	code = 
		set_flag(1,17,2);
	break;
begintalknode 55;
	state = 51;
	nextstate = -1;
	condition = get_flag(1,21) == 0;
	question = "So you can't teach spells or heal people?";
	text1 = "Ethan shrugs.";
	text2 = "_Sorry, but I can't do either of those._";
	code = 
		set_flag(1,21,1);
	break;
begintalknode 56;
	state = 50;
	nextstate = -1;
	condition = get_flag(1,17) == 3;
	question = "Alyse knows about your scheme.";
	text1 = "Ethan frowns. _Now why'd you have to go and do that? I was hoping to milk that for another month or two. Now I've got to think up something else..._";
	text2 = "He goes back to sweeping.";
	action = END_TALK;
	code = 
		set_flag(1,17,4);
		if(get_flag(50,0) != 0)
			remove_string(2);
	break;
begintalknode 57;
	state = 51;
	nextstate = -1;
	condition = get_flag(1,23) == 0;
	question = "Don't you have other people to clean the cathedral for you?";
	text1 = "Ethan looks at you in a way that suggests that was a stupid question.";
	text2 = "_Well, no. It's part of our duty to the winds to keep this cathedral clean. And most of us feel like it's our duty to do it ourselves._";
	text3 = "_Of course, some people skip out on helping, because they 'don't want to dirty themselves with the physical'. But if you ask me, I think they're just being lazy. I like it, actually. A little bit of manual labor feels really good every now and then._";
	code = 
		set_flag(1,23,1);
	break;
begintalknode 58;
	state = -1;
	nextstate = 50;
	question = "Ethan";
	text1 = "This middle-aged man seems a bit jittery, but he's doing his best to pray. He's dressed like a priest, but his robe has a lot of dust on it, as well as a few unidentifiable stains. A broom lies on the ground next to him.";
	text2 = "He notices your presence, he just doesn't say anything until he finishes a lengthy passage of what could only be holy text.";
	text3 = "_Greetings, friends. My name is Ethan._";
	text4 = "_Greetings, friend. My name is Ethan._";
	text5 = "Ethan looks just as dirty as before, just a bit more nervous. His broom lies on the ground next to him, and he's busy praying when you approach him. He continues speaking for a few minutes before greeting you again.";
	text6 = "Ethan is still here, silently staring at the stained glass window to the north.";
	action = INTRO;
	code = 
		set_flag(11,11,1);
		if(party_size() == 1)
			remove_string(3);
		else
		remove_string(4);
		if(get_flag(11,1) == 1)
			remove_string(5);
		else {
		set_flag(11,1,1);
		remove_string(6);
	}
	break;
begintalknode 60;
	state = -1;
	nextstate = 60;
	question = "Norbert";
	text1 = "This young-looking man looks like most other priests you've seen, just a little more tense. He's staring north with alarming intensity, almost as if he was trying to ignore you.";
	text2 = "You wait a while, hoping for him to break the uncomfortable silence so that you don't have to. But after a few awkward minutes, you tap him on the shoulder. He yelps.";
	text3 = "_Um... my name is Norbert. What do you want?_";
	text5 = "Norbert is still here, still doing his level best to ignore your presence.";
	action = INTRO;

begintalknode 61;
	state = 60;
	nextstate = 61;
	condition = get_flag(1,24) == 0;
	question = "What are you doing?";
	text1 = "_I'm training to become a full member of the priesthood,_ he says, hesitating to add more.";

begintalknode 62;
	state = 61;
	nextstate = -1;
	question = "How does standing still and doing nothing accomplish that?";
	text1 = "He slouches a bit. _Look, it's all about inner peace. And besides, Brother Silas said that I need to work on it, otherwise I'll be driven insane by the first batch of adventurers to seek my help reviving their stoned friend._";
	text2 = "_But now, Brother Silas is insane, and I can't get another lesson from him until the mages cure him, which means that our magic isn't enough, which makes me wonder why I'm doing this in the first place!_";
	text3 = "He shudders, and tenses up again.";
	text4 = "_It's enough to make me want to take the easy way out... become a sage and retire early._";
	code = 
		set_flag(1,24,1);
	break;
begintalknode 63;
	state = 60;
	nextstate = -1;
	condition = party_size() != 1;
	question = "Can you help us at all?";
	text1 = "Norbert sighs. _I'm just an apprentice, so no. I can't heal you, and I can't teach magic._";
	text5 = "_Look, I already told you, I'm just an apprentice. I can't do anything until I finish my training._";
	code = 
		if((get_flag(1,24) == 1) || (get_flag(1,25) == 1))
			remove_string(1);
		else {
		remove_string(5);
		set_flag(1,25,1);
	}
	break;
begintalknode 64;
	state = 60;
	nextstate = -1;
	condition = party_size() == 1;
	question = "Can you help me at all?";
	text1 = "Norbert sighs. _I'm just an apprentice, so no. I can't heal you, and I can't teach magic._";
	text5 = "_Look, I already told you, I'm just an apprentice. I can't do anything until I finish my training._";
	code = 
		if((get_flag(1,24) == 1) || (get_flag(1,25) == 1))
			remove_string(1);
		else {
		remove_string(5);
		set_flag(1,25,1);
	}
	break;
begintalknode 65;
	state = 60;
	nextstate = -1;
	condition = get_flag(1,4) > 0;
	question = "What do you think about the whole ghost situation?";
	text1 = "_Honestly, I'm kind of worried. So, I plan on staying in here until it's all over, anyway. I figure the safest place has to be the sanctuary, what with Father Richardson and the altars in here._";
	text2 = "_On the plus side, even if the ghosts escape, they probably won't be coming after me. I never did anything to anger them._";
	text3 = "_Well, now that they're gone, I don't really have much of an opinion on it. I'm just glad we're safe._";
	text4 = "_And they never came for me, so I'm glad,_ he adds with a smile.";
	code = 
		if(get_flag(50,1) == 0) {
			clear_strings();
			add_string(1);
			add_string(2);
		}
		else {
		clear_strings();
		add_string(3);
		add_string(4);
	}
	break;
begintalknode 70;
	state = -1;
	nextstate = 70;
	question = "Paula";
	text1 = "This long-haired woman carries a basket of assorted plants in one hand and a trowel in the other. She appears to be surveying the grounds.";
	text2 = "_Greetings. My name is Paula. How can I help you?_";
	text5 = "Paula is still here, occasionally bending over to examine a blade of grass.";
	action = INTRO;

begintalknode 71;
	state = 70;
	nextstate = 71;
	question = "What is your job here?";
	text1 = "_Well, besides being a priestess, I act as the cathedral's groundskeeper. It's one of those jobs that we're all supposed to share, but I am the only one with any patience when it comes to caring for plants._";
	text2 = "She sighs. _In fact, three of us basically keep the cathedral from falling apart. Felix takes care of the catacombs, which nobody wants to deal with. And then Ethan keeps the rest of the building clean and functional._";
	text5 = "_I thought I told you already. I'm the groundskeeper, but I'm also a priestess._";
	code = 
		if(get_flag(1,27) != 0) {
			clear_strings();
			add_string(5);
		}
		else {
		if(get_flag(1,27) == 0)
			set_flag(1,27,1);
		remove_string(5);
	}
	break;
begintalknode 72;
	state = 71;
	nextstate = -1;
	question = "What are you working on now?";
	text1 = "_Well, I'm trying to figure out if we can start an herb garden somewhere on the grounds. The problem is that not a lot of herbs are really all that pretty, or at least not pretty enough for the main gardens._";
	text2 = "_Because of that, I had to start up a tiny patch of herbs out behind the building, where nobody can really see them. And because I know you're going to ask, they're not ripe yet and they won't be ripe for months. So leave them alone._";
	text3 = "She gestures to a patch of tilled ground near the building. _I had to start the herbs back here, where nobody can really see them. And because I know you're going to ask, they're not ripe yet and they won't be ripe for months. So leave them alone._";
	text4 = "_Anyway, soon I'll know if this soil is right for anything useful._";
	text5 = "She points at the plot of herbs and sighs.";
	text6 = "_I told you already. I'm trying to figure out what can grow around here._";
	code = 
		if(get_flag(1,27) != 1) {
			clear_strings();
			if(party_can_see_loc(26,16) == 1)
				add_string(5);
			add_string(6);
		}
		else {
		clear_strings();
		add_string(1);
		set_flag(1,27,2);
		if(party_can_see_loc(26,16) == 1)
			add_string(3);
		else
		add_string(2);
	}
	break;
begintalknode 73;
	state = 70;
	nextstate = -1;
	condition = (get_flag(1,28) == 0) && (party_size() != 1);
	question = "Can you help us at all?";
	text1 = "She shakes her head, probably more out of annoyance than anything else. _I assume that you expect me to teach you spells and heal you. Sadly, I can do neither. Father Richardson is the only one of us who is allowed to do either._";
	text2 = "_Besides, I am not skilled in the types of healing that would benefit you. I can heal plants and animals, and I can cure some minor illnesses in people. But adventurer-caliber healing is outside of my expertise._";
	text3 = "_However, I have a healthy knowledge of alchemy, and I believe I know a few recipes that might benefit you. I could teach them to you for a small fee._";
	code = 
		set_flag(1,28,1);
	break;
begintalknode 74;
	state = 70;
	nextstate = -1;
	condition = (get_flag(1,28) == 0) && (party_size() == 1);
	question = "Can you help me at all?";
	text1 = "She shakes her head, probably more out of annoyance than anything else. _I assume that you expect me to teach you spells and heal you. Sadly, I can do neither. Father Richardson is the only one of us who is allowed to do either._";
	text2 = "_Besides, I am not skilled in the types of healing that would benefit you. I can heal plants and animals, and I can cure some minor illnesses in people. But adventurer-caliber healing is outside of my expertise._";
	text3 = "_However, I have a healthy knowledge of alchemy, and I believe I know a few recipes that might benefit you. I could teach them to you for a small fee._";
	code = 
		set_flag(1,28,1);
	break;
begintalknode 75;
	state = 70;
	nextstate = -1;
	condition = get_flag(1,28) == 1;
	question = "What recipes can you teach?";
	text1 = "Paula finishes explaining the recipes she can teach.";
	text2 = "_Anything else I can help you with?_ she asks with a smile.";
	code = 
		begin_shop_mode("Paula's Recipes","Paula knows a few recipes that should be fairly useful to you. Unfortunately, they're just various healing recipes.",9,3,-1);
	break;
begintalknode 76;
	state = 70;
	nextstate = -1;
	condition = get_flag(1,4) > 0;
	question = "What do you think of this whole ghost problem?";
	text1 = "Paula shrugs. _From what I understand, they should be stuck inside the cathedral. So I can't say I'm all that worried right now. And besides, I have nothing to do with them, so I don't see why they'd come after me._";
	text2 = "_If I were you, I'd watch myself. Ghosts can get pretty nasty once you get them angry._";
	text3 = "Paula shrugs. _Well, from what I understand, they're gone. So, I don't really mind. Besides, I had nothing to do with them._";
	code = 
		if(get_flag(50,1) == 0) {
			clear_strings();
			add_string(1);
			add_string(2);
		}
		else {
		clear_strings();
		add_string(3);
	}
	break;
begintalknode 80;
	state = -1;
	nextstate = 80;
	question = "Felix";
	text1 = "Felix sits huddled in the corner, looking just as grimy and disheveled as before. However, his face doesn't show the same degree of concentration, turning his expression into a vacant stare.";
	text2 = "His voice sounds lower and hollow, and his breathing sounds ragged.";
	text3 = "_What do you want from me now?_";
	text5 = "Felix is still huddled down in the corner, breathing irregularly. He doesn't say anything to you.";
	text6 = "Felix is slumped over in the corner, asleep. After all he's been through, you don't have the heart to wake him.";
	action = INTRO;
	code = 
		if(get_flag(50,1) == 0)
			remove_string(6);
		else {
		remove_string(5);
		end();
	}
	break;
begintalknode 81;
	state = 80;
	nextstate = -1;
	question = "Are you okay?";
	text1 = "He shudders. _Yes, I'm fine. I won. The ghosts lost. After you let them escape, they rushed towards me, and..._ he trails off into a coughing fit.";
	text2 = "_I won. I'm still alive. Now get to the point. Why are you bothering me?_";
	text5 = "He begins to shake violently, and he makes a raspy croaking sound. _Just tell me why you're bothering me._";
	code = 
		if(get_flag(11,3) == 1) {
			remove_string(1);
			remove_string(2);
		}
		else {
		remove_string(3);
		set_flag(11,3,1);
	}
	break;
begintalknode 82;
	state = 80;
	nextstate = -1;
	condition = (get_flag(11,4) == 0) && (get_flag(1,4) == 2);
	question = "Father Richardson said you know how to fix the wards.";
	text1 = "Felix grunts, and then his neck starts to spasm. After a few painful seconds, he gets himself under control.";
	text2 = "_Yes, I know how to fix this. It seems that the main suppression field generator was weakened. It's not off. Otherwise, the ghosts would be out. But the machine needs to be readjusted._";
	text3 = "_So we just need a new control crystal. They take at least a week to craft and several weeks to get out here. Thank the winds that there's an extra or two. They should be up in the storage attic._";
	text4 = "_I just can't remember which attic. So you figure it out. But the machine is at the top of the southern spire._";
	text5 = "He starts coughing again. _I hope you got that. I'm not repeating it._";
	code = 
		clear_quest(6);
		toggle_quest(7,1);
		set_flag(11,4,1);
	break;
begintalknode 83;
	state = 80;
	nextstate = -1;
	condition = party_size() == 1;
	question = "Any advice for me?";
	text1 = "_You'll have to disrupt the ghosts. They'll try to keep you from getting there. To the storage attics. And there were definitely mages. They won't let you work on the machine while they're up and moving._";
	text2 = "_Pay most attention to the mages. They'll be able to keep you from operating the machines. And they might corrupt the crystals. So hurry!_";
	text5 = "_Disrupt the ghosts. Take out the mages. Hurry!_";
	code = 
		if(get_flag(11,5) == 1) {
			remove_string(1);
			remove_string(2);
		}
		else {
		set_flag(11,5,1);
		remove_string(5);
	}
	break;
begintalknode 84;
	state = 80;
	nextstate = -1;
	condition = party_size() != 1;
	question = "Any advice for us?";
	text1 = "_You'll have to disrupt the ghosts. They'll try to keep you from getting there. To the storage attics. And there were definitely mages. They won't let you work on the machine while they're up and moving._";
	text2 = "_Pay most attention to the mages. They'll be able to keep you from operating the machines. And they might corrupt the crystals. So hurry!_";
	text5 = "_Disrupt the ghosts. Take out the mages. Hurry!_";
	code = 
		if(get_flag(11,5) == 1) {
			remove_string(1);
			remove_string(2);
		}
		else {
		set_flag(11,5,1);
		remove_string(5);
	}
	break;
begintalknode 90;
	state = -1;
	nextstate = 90;
	question = "Grimsley";
	text1 = "Grimsley (if that is this spirit's real name) stands before the small altar, with a hand incredibly close to its polished stone surface. Logically, if the ghost touches the altar, the holy energy within it should disrupt the spirit.";
	text2 = "Of course, you're not even certain that you should trust this shade of a priest. After all, you're supposed to be ridding the cathedral of ghosts, not fraternizing with them.";
	text3 = "Grimsley seems to notice these thoughts, and he speaks. _What do you wish to know?_";
	text5 = "Grimsley stands serenely before the altar, one hand still precariously close to its surface.";
	text6 = "You're a little surprised to see that Grimsley is still here. He looks far more substantial than before, and just a bit happier. He smiles broadly upon seeing you.";
	text7 = "_Greetings, friends._";
	text8 = "_Greetings, friend._";
	action = INTRO;
	code = 
		if(get_flag(50,1) == 2) {
			remove_string(5);
			if(party_size() == 1)
				remove_string(7);
			else
			remove_string(8);
		}
		else {
		remove_string(6);
		if(party_size() == 1)
			remove_string(7);
		else
		remove_string(8);
	}
	break;
begintalknode 91;
	state = 90;
	nextstate = -1;
	question = "Die, undead fiend! (Attack him)";
	text1 = "Grimsley sighs. _If that is really how you feel about it, then I will be forced to dispose of you._";
	text2 = "He begins to chant.";
	code = 
		set_attitude(14,10);
		set_flag(11,6,1);
		end();
	break;
begintalknode 92;
	state = 90;
	nextstate = 92;
	condition = get_flag(11,7) == 0;
	question = "Who are you?";
	text1 = "_My name is Grimsley, fourth class healer for the 35th brigade of Commander Garzahd's invasion force. You already know the rest of my story, as I was the one who spoke to you in the catacombs._";
	text2 = "He sighs. _I am also a priest of the Church of the Winds. Or, I suppose I was a priest... now, I expect that the others would hardly give a damn about my soul at this point._";
	code = 
		set_flag(11,7,1);
	break;
begintalknode 93;
	state = 90;
	nextstate = -1;
	question = "Why aren't you attacking?";
	text1 = "_Well, to be honest, I differ with my captain in terms of opinions. I refuse to fight my former colleagues, and thus I seek another way out of this cathedral._";
	text2 = "_Preferably, one without more bloodshed than we have already endured._";
	text5 = "_I told you already. I am contemplating a peaceful solution to the conundrum we are in._";
	code = 
		if(get_flag(11,8) >= 1) {
			remove_string(1);
			remove_string(2);
		}
		else {
		remove_string(5);
		set_flag(11,8,1);
	}
	break;
begintalknode 94;
	state = 90;
	nextstate = -1;
	condition = get_flag(11,8) == 1;
	question = "What are you doing here?";
	text1 = "_I am trying to pray to the winds. However, I'm afraid they cannot hear my prayers, particularly when I cannot touch this altar without being disrupted myself._";
	text2 = "He stares at the altar for a minute.";
	text3 = "_I just want to commune with the winds again. Maybe, just maybe, if we can escape, then I can do that._";
	code = 
		set_flag(11,8,2);
	break;
begintalknode 95;
	state = 90;
	nextstate = -1;
	condition = (get_flag(11,8) >= 1) && (party_size() != 1) && (get_flag(11,9) <= 1);
	question = "Can we do anything to help you?";
	text1 = "_As a matter of fact, yes. We have found the machine that controls the suppression field, and the mechanisms that drive it. However, we cannot get close enough to the machine to turn it off, because it still emits a field._";
	text2 = "_So, we're trying to break through the wards on the building itself. It's taking too long, and sooner or later someone's going to try and disrupt us for good. But nobody else wants to hear me out._";
	text3 = "_The suppression field machine is controlled by a crystal. If I could find one of the crystals and work on it, then I'd be able to corrupt it so that it would neutralize the wards on the building. Then, we could simply leave._";
	text4 = "_If you can bring one of these crystals to me, and then place it in the field generator we can avoid significant bloodshed._";
	text5 = "_Just find one of the control crystals for the suppression field generator and bring it to me. The faster you act, the more bloodshed we can avoid._";
	code = 
		if(get_flag(11,9) == 1) {
			clear_strings();
			add_string(5);
		}
		else if(get_flag(11,9) == 0) {
		clear_strings();
		add_string(1);
		add_string(2);
		add_string(3);
		add_string(4);
		toggle_quest(8,1);
		set_flag(11,9,1);
	}
	break;
begintalknode 96;
	state = 90;
	nextstate = -1;
	condition = (get_flag(11,8) >= 1) && (party_size() == 1) && (get_flag(11,9) <= 1);
	question = "Can I do anything to help you?";
	text1 = "_As a matter of fact, yes. We have found the machine that controls the suppression field, and the mechanisms that drive it. However, we cannot get close enough to the machine to turn it off, because it still emits a field._";
	text2 = "_So, we're trying to break through the wards on the building itself. It's taking too long, and sooner or later someone's going to try and disrupt us for good. But nobody else wants to hear me out._";
	text3 = "_The suppression field machine is controlled by a crystal. If I could find one of the crystals and work on it, then I'd be able to corrupt it so that it would neutralize the wards on the building. Then, we could simply leave._";
	text4 = "_If you can bring one of these crystals to me, and then place it in the field generator, we can avoid significant bloodshed.._";
	text5 = "_Just find one of the control crystals for the suppression field generator and bring it to me. The faster you act, the more bloodshed we can avoid._";
	code = 
		if(get_flag(11,9) == 1) {
			clear_strings();
			add_string(5);
		}
		else if(get_flag(11,9) == 0) {
		clear_strings();
		add_string(1);
		add_string(2);
		add_string(3);
		add_string(4);
		toggle_quest(8,1);
		set_flag(11,9,1);
	}
	break;
begintalknode 97;
	state = 92;
	nextstate = -1;
	question = "You were part of Garzahd's invasion?";
	text1 = "Grimsley sighs, and stares at the altar.";
	text2 = "_Yes, I served the Empire in the war. To this day, I do not regret the choice, and I still believe that the Empire was right. Garzahd himself was a horrible fiend, but the cause we served was a great one._";
	text3 = "_However, I will admit that Avernum has done more than enough to redeem its actions, what with saving the continent of Valorim and all. To that end, I can no longer say that I harbor any hatred of Avernum or Avernites._";
	text4 = "_That is all the politics that I wish to discuss with you. Was there anything else you wanted to know?_";
	code = 
		set_flag(11,7,2);
	break;
begintalknode 98;
	state = 90;
	nextstate = -1;
	condition = (has_item(446) == 1) && (get_flag(11,9) == 1);
	question = "Here's the crystal you wanted. (Give him a control crystal)";
	text1 = "Not entirely certain how to hand him the crystal, you just hold it out in front of him. He gives you an incredulous look, then picks it out of your hand with his. An almost painful chill runs up your arm, and you try not to wince.";
	text2 = "He examines the crystal for a while, before experimentally jabbing a few fingers through it. Then, he starts gently caressing the outside of the crystal with his hands, until it turns a fiery orange.";
	text3 = "Satisfied, he holds the crystal up to the torchlight. _Ah, this should do it. Just place this in the field generator, and we'll be home free._";
	text4 = "He hands it back to you, sending another chill up your arm. This time, however, you avoid wincing, which makes the moment just a bit less awkward.";
	text5 = "Grimsley takes the crystal from you and repeats the motions you saw him perform before. Just like before, the crystal turns a bright reddish orange.";
	text6 = "He hands it back to you. _Try not to lose this one, alright?_";
	code = 
		take_item(446);
		reward_give(447);
		set_flag(11,9,2);
		if(get_flag(11,13) == 1) {
			clear_strings();
			add_string(5);
			add_string(6);
		}
		else {
		remove_string(5);
		remove_string(6);
		toggle_quest(8,0);
		toggle_quest(9,1);
	}
	break;
begintalknode 99;
	state = 90;
	nextstate = -1;
	condition = (get_flag(11,9) == 2) && (get_flag(11,12) == 0);
	question = "Why didn't you just get the crystal yourself?";
	text1 = "Grimsley frowns. _Don't you think I tried? When I went up to the attics looking for them, I thought for sure that I'd be able to get them. But they were secured in boxes enchanted to ward off undead such as myself._";
	text2 = "He sighs. _I tried to open one, and the next thing I remembered was waking up in the catacombs again. I'm fairly certain that I was disrupted, so I haven't tried since. That hurts more than you'd think._";
	code = 
		set_flag(11,12,1);
	break;
begintalknode 100;
	state = 90;
	nextstate = -1;
	condition = (party_size() == 1) && (get_flag(11,9) == 2) && (has_item(447) == 0) && (get_flag(50,1) == 0);
	question = "I lost the crystal you gave me.";
	text1 = "Grimsley sighs. _Well, then go get another control crystal and bring it to me. And next time, don't let the mages see you with one. They won't even stop to think before they blast it away._";
	code = 
		set_flag(11,9,1);
	break;
begintalknode 101;
	state = 90;
	nextstate = -1;
	condition = (party_size() != 1) && (get_flag(11,9) == 2) && (has_item(447) == 0) && (get_flag(50,1) == 0);
	question = "We lost the crystal you gave us.";
	text1 = "Grimsley sighs. _Well, then go get another control crystal and bring it to me. And next time, don't let the mages see you with one. They won't even stop to think before they blast it away._";
	code = 
		set_flag(11,9,1);
	break;
begintalknode 102;
	state = 90;
	nextstate = -1;
	condition = (get_flag(50,1) == 2) && (party_size() == 1);
	question = "I switched the crystals.";
	text1 = "Grimsley laughs. _I know. The rest of the troops have left already. I only stayed behind because it'd give me the chance to speak with you again. You see, we all appreciate what you've done for us, even the fools that said you should've been killed._";
	text2 = "_And I particularly appreciate what you've done, because it minimized the conflict between my former colleagues of the Church and the rest of the troops. So, I wanted to give you a boon._";
	text3 = "He holds out a hand expectantly, and somewhat reluctantly, you touch it. The feeling is something like having your brain pried open and stuffed full of dusty tomes. However, when it subsides, you feel more alert.";
	text5 = "_And now, it's time that I left. The rest of the troops will be expecting me. We have a great wrong to right. Farewell, friends._";
	text6 = "And with that, Grimsley waves his arms and disappears.";
	action = END_TALK;
	code = 
		set_flag(11,15,1);
		alter_stat(1000,2,1);
		play_sound(52);
		award_party_xp(1000,20);
		erase_char(14);
	break;
begintalknode 103;
	state = 90;
	nextstate = -1;
	condition = (get_flag(50,1) == 2) && (party_size() != 1);
	question = "We switched the crystals.";
	text1 = "Grimsley laughs. _I know. The rest of the troops have left already. I only stayed behind because it'd give me the chance to speak with you again. You see, we all appreciate what you've done for us, even the fools that said you should've been killed._";
	text2 = "_And I particularly appreciate what you've done, because it minimized the conflict between my former colleagues of the Church and the rest of the troops. So, I wanted to give you a boon._";
	text3 = "He holds out a hand expectantly, and somewhat reluctantly, you touch it. The feeling is something like having your brain pried open and stuffed full of dusty tomes. However, when it subsides, you feel more alert.";
	text4 = "The rest of you touch his hand as well, with similar results.";
	text5 = "_And now, it's time that I left. The rest of the troops will be expecting me. We have a great wrong to right. Farewell, friends._";
	text6 = "And with that, Grimsley waves his arms and disappears.";
	action = END_TALK;
	code = 
		set_flag(11,15,1);
		alter_stat(1000,2,1);
		play_sound(52);
		award_party_xp(1000,20);
		erase_char(14);
	break;
begintalknode 110;
	state = -1;
	nextstate = -1;
	question = "Empire Dervish";
	text1 = "Most Dervishes are rather aloof, particularly with regard to adventurers. This one is no exception. Despite your best attempts at starting up a conversation, he refuses to speak to you.";
	text3 = "Of course, it could have something to do with your rather embarassing behavior out in front of the cathedral.";
	text4 = "This is more than a little odd, given the warm gratitude you received earlier from him. Strange.";
	code = 
		if((get_flag(50,1) == 2) && (get_flag(11,16) == 1))
			remove_string(3);
		else
			remove_string(4);
		if(get_flag(30,4) != 1)
			remove_string(3);
	break;
